package chapter01;

import java.util.Arrays;

public class Test25_Max {
    public static void main(String[] args) {
        int[] a = {1,2,35,1,24,21,69,85,21};
        int max = a[0];
        int key = 0;
        for(int i=0;i<a.length;i++){
            if(max<a[i]){
                max = a[i];
                key = i;
            }
        }
        System.out.println(max);
        System.out.println(key);
        int temp = a[key];
        a[key] = a[a.length-1];
        a[a.length-1] = temp;
        System.out.println(Arrays.toString(a));
    }
}
